function getCharts(id, type) {
    var myChart = echarts.init(document.getElementById(id));
    var data2 = [299, 400, 501, 299, 501, 400, 501, 299, 400, 501, 299, 501, 400, 501, 299, 400, 501, 299, 501, 400, 501];
    var data3 = [400, 400, 501, 501, 299, 666, 501, 400, 400, 501, 501, 299, 666, 501, 400, 400, 501, 501, 299, 666, 501];
    var data = [299, 400, 501, 299, 501, 400, 501];
    var array = [1300, 2300, 3400, 4200, 5100];
    var array1 = [6470, 6470, 6470, 6470, 6470];
    var data5 = [{
        value: 3661,
        name: '导游辱骂游客',
        itemStyle: {
            normal: {
                color: 'rgba(0,255,255,0.58)',
                borderWidth: 1,
                borderColor: '#00ffff'
            }
        }
    }, {
        value: 5713,
        name: '态度不好',
        itemStyle: {
            normal: {
                color: 'rgba(55,201,54,0.6)',
                borderWidth: 1,
                borderColor: '#37c936'
            }
        }
    }, {
        value: 9938,
        name: '误导游客',
        itemStyle: {
            normal: {
                color: 'rgba(248,231,28,0.64)',
                borderWidth: 1,
                borderColor: '#F8E71C'
            }
        }
    }, {
        value: 17623,
        name: '虚假宣传',
        itemStyle: {
            normal: {
                color: 'rgba(249,95,182,0.53)',
                borderWidth: 1,
                borderColor: '#f95fb8'
            }
        }
    }, {
        value: 3299,
        name: '价格欺诈',
        itemStyle: {
            normal: {
                color: 'rgba(74,114,255,0.58)',
                borderWidth: 1,
                borderColor: '#4a72ff'
            }
        }
    }];
    var data6 = [{
        value: 3661,
        name: '高级',
            itemStyle: {
            normal: {
                color: 'rgba(0,255,255,0.58)',
                borderWidth: 1,
                borderColor: '#00ffff'
            }
        }
    }, {
        value: 5713,
        name: '中级',
        itemStyle: {
            normal: {
                color: 'rgba(55,201,54,0.6)',
                borderWidth: 1,
                borderColor: '#37c936'
            }
        }
    }, {
        value: 9938,
        name: '初级',
        itemStyle: {
            normal: {
                color: 'rgba(248,231,28,0.64)',
                borderWidth: 1,
                borderColor: '#F8E71C'
            }
        }
    }, {
        value: 17623,
        name: '特技',
        itemStyle: {
            normal: {
                color: 'rgba(249,95,182,0.53)',
                borderWidth: 1,
                borderColor: '#f95fb8'
            }
        }
    }];
    //柱图1
    var options1 = {
        backgroundColor: 'none',
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'line' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            top: '10%',
            left: '3%',
            right: '4%',
            bottom: '17%',
            containLabel: true //grid 区域包含坐标轴的刻度标签。
        },
        xAxis: [{
            type: 'category',
            data: ['遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市', '遂宁市'],
            axisTick: {
                alignWithLabel: true //柱子剧中对齐
            },
            axisLabel: {
                rotate: 45,
                textStyle: {
                    color: '#9a9bae',
                } //刻度标签文字颜色
            }
        }],
        yAxis: [{
            type: 'value',
            axisLabel: {
                textStyle: {
                    color: '#9a9bae',
                }, //刻度标签文字颜色
            },
            axisTick: {
                show: false
            }, //取消坐标中间刻度
            axisLine: {
                lineStyle: {
                    color: "#343448"
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(0,255,255,0.19)',
                }, //坐标轴在 grid 区域中的分隔线颜色
            },
        }],
        series: [{
                name: '2016年',
                type: 'bar',
                barWidth: '40%',
                label: {
                    normal: {
                        show: false,
                        position: 'top',
                        textStyle: {
                            color: '#5b83e5',
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: ' rgba(55,201,54,0.60)',
                        borderWidth: 2,
                        borderColor: '#37C936'
                    },
                },
                data: data2
            },
            {
                name: '2016年',
                type: 'line',
                barWidth: '28',
                label: {
                    normal: {
                        show: false,
                        position: 'top',
                        textStyle: {
                            color: '#5b83e5',
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: '#298434'
                    },
                },
                data: _.map(data2, function(i) {
                    return i / 2 + 300
                })
            }
        ]
    };
    //饼图1
    var options2 = {
        backgroundColor: 'none',
        tooltip: {
            // show: false,
            trigger: 'item',
            formatter: "{b}: {c} 人 ({d}%)"
        },
        textStyle: {
          color: '#fff'
        },
        series: [{
            type: 'pie',
            radius: ["0", '80%'],
            //    roseType: 'radius',
            label: {
                normal: {
                    textStyle: {
                        fontSize: 14
                    },
                    formatter: function (param) {
                        return param.name + ':\n' + Math.round(param.percent) + '%';
                    }
                }
            },
            labelLine: {
                normal: {
                    lineStyle: {
                        width: 2,
                        color: '#00FFFF'
                    }
                }
            },
            itemStyle: {
                normal: {
                    shadowBlur: 30,
                    shadowColor: 'rgba(0, 0, 0, 0.4)'
                }
            },
            data: data6
        }]
    };
    //饼图2
    var options3 = {
        backgroundColor: 'none',
        tooltip: {
            trigger: 'item',
            formatter: "{b}: {c} 人 ({d}%)"
        },
        textStyle: {
          color: '#fff',
        },
        series: [{
            type: 'pie',
            radius: ["32%", '80%'],
            label: {
                normal: {
                    textStyle: {
                        fontSize: 14
                    },
                    formatter: function (param) {
                        return param.name + ':\n' + Math.round(param.percent) + '%';
                    }
                }
            },
            labelLine: {
                normal: {
                    lineStyle: {
                        width: 2,
                        color: '#00FFFF'
                    }
                }
            },
            itemStyle: {
                normal: {
                    shadowBlur: 30,
                    shadowColor: 'rgba(0, 0, 0, 0.4)'
                }
            },
            data: data5
        }]
    };

    if (type == 'bar') {
        myChart.setOption(options1);
    } else if (type == 'pie') {
        myChart.setOption(options2);
    } else if (type == 'pie-a') {
        myChart.setOption(options3);
    }
    window.onresize = myChart.resize;

}
